# 练习题
# 1. ⽣成⼀个包含100个key的字典，每个value的值不能⼀样
import random

my_dict = {}
for i in range(100):
    my_dict[i] = random.randint(1, 100)
print(my_dict)

# 2. {‘k0’: 0, ‘k1’: 1, ‘k2’: 2, ‘k3’: 3, ‘k4’: 4, ‘k5’: 5, ‘k6’: 6, ‘k7’: 7, ‘k8’: 8, ‘k9’: 9} 请把这个dict中key⼤于5的
# 值value打印出来。
dict2 = {'k0': 0, 'k1': 1, 'k2': 2, 'k3': 3, 'k4': 4, 'k5': 5, 'k6': 6, 'k7': 7, 'k8': 8, 'k9': 9}
for key, value in dict2.items():
    if value > 5:
        print(value)

# 3. 把题2中value是偶数的统⼀改成-1
dict3 = {'k0': 0, 'k1': 1, 'k2': 2, 'k3': 3, 'k4': 4, 'k5': 5, 'k6': 6, 'k7': 7, 'k8': 8, 'k9': 9}
for key, value in dict3.items():
    if value % 2 == 0:
        dict3[key] = -1
print(dict3)

# 4. 请设计⼀个dict, 存储你们公司每个⼈的信息， 信息包含⾄少姓名、年龄、电话、职位、⼯资，并
# 提供⼀个简单的查找接⼝，⽤户按你的要求输⼊要查找的⼈，你的程序把查到的信息打印出来。
# 初始化员工信息字典
company_employees = {
    "alice": {"姓名": "Alice", "年龄": 30, "电话": "1234567890", "职位": "工程师", "工资": 12000},
    "bob": {"姓名": "Bob", "年龄": 35, "电话": "9876543210", "职位": "经理", "工资": 15000},
    "charlie": {"姓名": "Charlie", "年龄": 28, "电话": "5556667777", "职位": "设计师", "工资": 10000}
}


def get_employee_info(name):
    # 转换成小写以确保不区分大小写
    low_case_name = name.lower()

    if low_case_name in company_employees:
        employee_info = company_employees[low_case_name]
        print("找到以下信息:")
        for name, info in employee_info.items():
            print(f"{name}: {info}")
    else:
        print(f"未找到名为 {low_case_name} 的员工信息。")


# 示例查找功能
get_employee_name = input("请输入要查找的员工姓名: ")
get_employee_info(get_employee_name)
